home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / gsdbloo.exe / DEMOB002.PAS < prev    next >
Pascal/Delphi Source File  |  1992-02-24  |  2KB  |  60 lines

  1. program DemoB002;
  2. {------------------------------------------------------------------------------
  3.                               DBase File Lister
  4.                                    Sample 2
  5.                                  Demo Program
  6.  
  7.        Copyright (c)  Richard F. Griffin
  8.  
  9.        10 February 1992
  10.  
  11.        102 Molded Stone Pl
  12.        Warner Robins, GA  31088
  13.  
  14.        -------------------------------------------------------------
  15.        This program demonstrates how dBase files may be listed using
  16.        Griffin Solutions units.
  17.  
  18.        If the DEMOB1.DBF file does not exist, the program will display a
  19.        a message that the file was not found and to run DEMOB001 to make
  20.        the file.
  21.  
  22.        The program initializes a dBase file object, opens the file, and
  23.        proceeds to list selected fields from each record.
  24.  
  25. -------------------------------------------------------------------------------}
  26.  
  27. uses
  28.    CRT,
  29.    DOS,
  30.    GS_dBase,
  31.    GS_DBFld,
  32.    GS_FileH;
  33. var
  34.    MyFile  : GS_dBFld_Objt;
  35.    ftest   : file;
  36. begin
  37.    ClrScr;
  38.    if not GS_FileExists(ftest, 'DEMOB1.DBF') then
  39.    begin
  40.       writeln('File DEMOB1.DBF not found.  Run DEMOB001 to create.');
  41.       halt;
  42.    end;
  43.                        {The 'Real' example starts here}
  44.  
  45.    MyFile.Init('DEMOB1');          {Initialize object using the dBase III}
  46.                                   {file DEMO1.  DBF Extension assumed}
  47.    MyFile.Open;                   {Open the object's file}
  48.    MyFile.GetRec(Top_Record);     {Get the first record in the file}
  49.    while not MyFile.File_EOF do   {Repeat until end-of-file}
  50.    begin
  51.       writeln(MyFile.FieldGet('LASTNAME'),' ',
  52.               MyFile.FieldGet('FIRSTNAME'),'  ',
  53.               MyFile.FieldGet('BIRTHDATE'));
  54.       MyFile.GetRec(Next_Record); {Get the next sequential record}
  55.    end;
  56.    MyFile.Close;
  57.    write('Press any Key to continue:');
  58.    repeat until KeyPressed;
  59. end.
  60.